/* $RCSFile: ADNDynContracttemplate.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynContracttemplate.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:48  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:32  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynContracttemplate */
/* Date 2010-01-06 16:05:21Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
    public class ADNDynContracttemplate : DynEntity
    {
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.contracttemplate)
            {}

            public override Type DynType
            { get { return typeof(ADNDynContracttemplate); } }

            public override string DynTypename
            {   get{ return CrmStr.contracttemplate;}}

            public override DynEntity Build()
            {   return new ADNDynContracttemplate();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynContracttemplate(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynContracttemplate(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynContracttemplate(w,PrimaryKeyValue);}
        }

        static ADNDynContracttemplate(){new Ftor();} 

        public override bool HasOwnerProperty
        {
            get { return false; }
        }
        public ADNDynContracttemplate() : base() { }
        
        public ADNDynContracttemplate(CRMWrapperBase w,string PrimaryFieldValue)
            : base(w,CrmStr.contracttemplate)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynContracttemplate(CRMWrapperBase w,Guid CrmId) : base(w,CrmStr.contracttemplate,CrmId) { }
        
        public ADNDynContracttemplate(CRMWrapperBase w,InternalDynamicEntity e) : base(w,CrmStr.contracttemplate,e,null,null) { }
        
        public ADNDynContracttemplate(CRMWrapperBase w,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(w,CrmStr.contracttemplate,e,prop,s) { }
        
        public ADNDynContracttemplate(ResetWrapperHandler fn,string PrimaryFieldValue)
            : base(fn,CrmStr.contracttemplate)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynContracttemplate(ResetWrapperHandler fn,Guid CrmId) : base(fn,CrmStr.contracttemplate,CrmId) { }
        
        public ADNDynContracttemplate(ResetWrapperHandler fn,InternalDynamicEntity e) : base(fn,CrmStr.contracttemplate,e,null,null) { }
        
        public ADNDynContracttemplate(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(fn,CrmStr.contracttemplate,e,prop,s) { }

        /* Properties */

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public Guid contracttemplateid
        {
            get
            { return KeyPropertyValue(CrmStr.contracttemplateid); }
            set
            { AddKeyProperty(CrmStr.contracttemplateid,value); }
        }

        protected override void SetCrmIdProperty(Guid crmId)
        {
            if ( !dicProperty.ContainsKey(CrmStr.contracttemplateid) || KeyPropertyValue(CrmStr.contracttemplateid) != crmId )
                contracttemplateid = crmId;
        }
        public override Guid PrimaryKeyGuidValue
        {
            get
            { return contracttemplateid; }
            set { contracttemplateid = value; }
        }
        public override string PrimaryFieldName
        {
            get
            { return CrmStr.name; }
            set
            {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return name;
            }
            set
            {
                name =   value;
            }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public string abbreviation
        {
            get
            { return StringPropertyValue(CrmStr.abbreviation); }
            set
            { AddStringProperty(CrmStr.abbreviation,value); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public int allotmenttypecode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.allotmenttypecode); }
            set
            { AddPicklistProperty(CrmStr.allotmenttypecode,value); }
        }

        public string allotmenttypecodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.allotmenttypecode); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public int billingfrequencycode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.billingfrequencycode); }
            set
            { AddPicklistProperty(CrmStr.billingfrequencycode,value); }
        }

        public string billingfrequencycodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.billingfrequencycode); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public int contractservicelevelcode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.contractservicelevelcode); }
            set
            { AddPicklistProperty(CrmStr.contractservicelevelcode,value); }
        }

        public string contractservicelevelcodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.contractservicelevelcode); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public string description
        {
            get
            { return StringPropertyValue(CrmStr.description); }
            set
            { AddStringProperty(CrmStr.description,value); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public string effectivitycalendar
        {
            get
            { return StringPropertyValue(CrmStr.effectivitycalendar); }
            set
            { AddStringProperty(CrmStr.effectivitycalendar,value); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public override string name
        {
            get
            { return StringPropertyValue(CrmStr.name); }
            set
            { AddStringProperty(CrmStr.name,value); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public override Guid organizationid
        {
            get
            { return LookupPropertyValue(CrmStr.organizationid); }
        }

        [CrmDynAttribute(CrmStr.contracttemplate)]
        public bool usediscountaspercentage
        {
            get
            { return BooleanPropertyValue(CrmStr.usediscountaspercentage); }
            set
            { AddBooleanProperty(CrmStr.usediscountaspercentage,value); }
        }
    }
}